package com.jy.api.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.Date;
import java.util.TimeZone;

/**
 * Created by hanxi on 2018/4/19.
 */
public class CommonUtil {
    public static ZoneId defaultTimeZone() {
        return ZoneId.of("Asia/Shanghai");
    }

    public static Date parseDate(String dateStr) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        df.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));

        try {
            return df.parse(dateStr);
        } catch (ParseException e) {
            throw new RuntimeException(e.getMessage());
        }
    }
}
